<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/

get_config_keytable("bbs_edit");
empty($do) && $do = 'list';
if ($do == 'edit') {
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."bbs  WHERE id = '$id'");
	include_once('template/edit.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$id = getGP('id','P','int');
	$bbsclass = getGP('bbsclass','P');
	$title = getGP('title','P');
	$author = getGP('author','P');
	$origin = getGP('origin','P');
	$content = getGP('content','P');
	$issuedate = get_date('Y-m-d H:i:s',PHP_TIME);
	$readnum = 0;
	$uid = $_USER->id;
	$bbstyle = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."bbsclass  WHERE id = '$bbsclass'");
	if($bbstyle["type"]=='1'){
	$type =2;
	}else{
	$type =1;
	}	
	
	//主表信息
	$bbs = array(
		'bbsclass' => $bbsclass,
		'title' => $title,
		'author' => $author,
		'origin' => $origin,
		'content' => $content,
		'readnum' => $readnum,
		'type' => $type
	);
	update_db('bbs',$bbs, array('id' => $id));
	$content=$bbsclass.get_inc_log(1).$title.get_inc_log(1).$author.get_inc_log(1).$origin.get_inc_log(1).$content.get_inc_log(1).$issuedate.get_inc_log(1).$readnum.get_inc_log(1).$type.get_inc_log(1).$uid;
	$title='编辑贴子';
	get_oa_log_dbadd($id,$content,$title,30,$_USER->id);
    goto_page('admin.php?ac=index&fileurl=bbs');
	

}

?>